#encoding=utf8
'''
Created on Apr 15, 2015

@author: jingyang <jingyang@smalltreemedia.com>
'''
from django.db import models
from core.widgets import CustomTextarea
from core.fields import CustomTextField


class ChangeLog(models.Model):
    ver_num = models.CharField('Version Num.', max_length=20, unique=True)
    update_time = models.DateField('Update at')
    title = models.CharField('Title', max_length=200)
    content = CustomTextField('Content', null=True, blank=True, widget=CustomTextarea)
    editor = models.CharField('Editor', max_length=100, null=True, blank=True,
        default='')
    create_time = models.DateTimeField('Created at', auto_now_add=True)

    def __unicode__(self):
        return 'Change Log of %s' % self.ver_num

    class Meta:
        verbose_name = 'Change Log'
        verbose_name_plural = 'Change Log'
        ordering = ('-update_time',)
